<table id="dataTable"></table>

{include file="system@block/layui" /}

<script type="text/javascript">
    layui.use(['opTable', 'tool', 'jquery', 'laydate'], function() {
        var $ = layui.jquery;
    	var laydate = layui.laydate;
        
    	laydate.render({
		    elem: '#create_date_range'
		    ,range: '~'
		    ,theme: 'molv'
		    ,mark: {'{:$today}':''}
	    	,change: function(value, date, endDate){
		    	$('#create_date_range').val(value);
            	$('#layui-laydate1').remove();//关闭面板
            }
		});
    	
    	var opTable = layui.opTable.render({
            elem: '#dataTable'
            ,url: '{:url("", ["uid" => $uid, "type" => $type, "date" => $date])}' //数据接口
            ,page: false //开启分页
            ,limit: 20
            ,limits: [20,50,100,150,200]
            ,text: {
                none : '暂无相关数据'
            }
            ,toolbar: false
            ,defaultToolbar: ['filter', 'exports', 'print']
            ,cols: [[ //表头
            	{field: 'userName', title:'姓名'}
            	,{field: 'userRole', title:'职能'}
            	,{field: 'typeName', title:'工序'}
            	,{field: 'clientOrdernum', title:'订单号'}
            	,{field: 'caichuangFabricWidth', title:'裁床实用布封'}
            	,{field: 'trueFabricWidthDiff', title:'布封差异'}
            	,{field: 'caichuangDosage', title:'裁床米长'}
            	,{field: 'lengthDiff', title:'米长差异'}
            ]]
       		 //  展开的列配置
			,openTable: function (itemData) {
				return {
					elem: '#child' + itemData.LAY_INDEX
					,id: 'child' + itemData.LAY_INDEX
					,data: layui.tool.setDataToList(itemData, itemData.list)
					,cellMinWidth: 100
					,toolbar: false
				    ,defaultToolbar: ['filter', 'exports', 'print']
					,cols: [[
						{field: 'cloth_num', title:'布号'}
		            	,{field: 'name', title:'布种'}
		            	,{field: 'color', title:'颜色'}
		            	,{field: 'true_fabric_width', title:'实用布封'}
		            	,{field: 'length', title:'米长'}
					]]
					,done: function () {
			        }
		        }
		      }
			,openType : 1
			,done: function(res, curr, count){
				//opTable.openAll();
			}
        });
        
    });
</script>